<?php
/**
 *
 * 搜索页
 *
 * @version        $Id: search.php 1 15:38 2010年7月8日Z tianya $
 * @package        DedeCMS.Site
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
require_once(dirname(__FILE__)."/../include/common.inc.php");
require_once(DEDEINC."/arc.searchview.class.php");
$typeid   = (isset($_GET['typeid']) && is_numeric($_GET['typeid'])) ? $_GET['typeid'] : 0;
$pagesize = (isset($pagesize) && is_numeric($pagesize)) ? $pagesize : 10;
// 根据栏目ID查询
if(!empty($typeid)){
    $query = "SELECT arc.*,tp.typename FROM `#@__archives` arc 
			  LEFT JOIN `#@__arctype` tp on arc.typeid=tp.id 
			  WHERE arc.typeid IN ($typeid) ORDER BY arc.sortrank desc LIMIT 0,10";
	$dsql->SetQuery($query);//将SQL查询语句格式化
	$dsql->Execute();//执行SQL操作
	$data = array();
	while($row = $dsql->GetArray()){
		$data[] = $row;
	}
	echo json_encode($data);
}else{
	echo $typeid;
	exit;
}
